package org.xukai.remoting.redis;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author xukai
 * @desc
 * @date 2017-01-02-下午 3:39
 */
public class SharedJedis {


//    public static void main(String[] args) {
//        List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
//        JedisShardInfo si = new JedisShardInfo("localhost", 6379);
//        si.setPassword("foobared");
//        shards.add(si);
////        ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(),shards);
////        ShardedJedis jedis = pool.getResource();
//        ShardedJedis jedis = new ShardedJedis(shards,ShardedJedis.DEFAULT_KEY_TAG_PATTERN);
////        pool.returnResource(jedis);
////        pool.destroy();
//
//    }
    static class Annoyance extends Exception {}
    static class Sneeze extends Annoyance {}


        public static void main(String[] args)
                throws Exception {
            try {
                try {
                    throw new Sneeze();
                }
                catch ( Annoyance a ) {
                    System.out.println("Caught Annoyance");
                    throw a;
                }
            }
            catch ( Sneeze s ) {
                System.out.println("Caught Sneeze");
                return ;
            }
            finally {
                System.out.println("Hello World!");
            }
        }
}
